# -*-coding:utf-8-*-
import os


class HtmlUrl:
    def get_urls(self, urls_file='new_url.txt'):
        if not os.path.exists(urls_file):
            return
        with open(urls_file, 'r') as file:
            urls = file.read().split('\n')
            file.close()
            urls.pop(-1)
            return urls

    def write_urls(self, data, urls_file='new_url.txt'):
        if not data:
            return
        with open(urls_file, 'rw') as file:
            file.write(file.read())
            for url in data:
                file.writelines(url + '\n')
            file.close()
        return True
